{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from sklearn.metrics import mean_squared_error\n",
    "from math import sqrt"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-11T05:16:19.218855200Z",
     "start_time": "2024-04-11T05:16:18.856000400Z"
    }
   },
   "id": "4a8a44f80dcb03d2"
  },
  {
   "cell_type": "markdown",
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "27f1e4ecd8f3256d"
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 默认参数+特征处理后的数据"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "dcde16493a87665a"
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 26.032771480463705\n"
     ]
    }
   ],
   "source": [
    "# 文件1是基准文件，文件2是用来比较的文件\n",
    "file_path_baseline = './Share_Bike_Data/actual_value.csv'\n",
    "file_path_compare = '.\\Share_Bike_Data\\Output\\XGBoost_默认参数.csv'\n",
    "\n",
    "# 读取两个文件\n",
    "df_baseline = pd.read_csv(file_path_baseline)\n",
    "df_compare = pd.read_csv(file_path_compare)\n",
    "            \n",
    "# 确保数据按id对齐，这里假设id列是按相同顺序排列的\n",
    "# 如果不是，您可能需要先对它们进行排序或使用merge操作来对齐数据\n",
    "rmse = sqrt(mean_squared_error(df_baseline['y'], df_compare['y']))\n",
    "\n",
    "print(f'RMSE: {rmse}')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-11T06:10:30.924076800Z",
     "start_time": "2024-04-11T06:10:30.915179Z"
    }
   },
   "id": "691021aa77fd36ed"
  },
  {
   "cell_type": "markdown",
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "323148ae8deab61b"
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 网格搜索+特征处理后的数据"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "8e990aa07f7a4e87"
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 24.40741862939895\n"
     ]
    }
   ],
   "source": [
    "# 文件1是基准文件，文件2是用来比较的文件\n",
    "file_path_baseline = './Share_Bike_Data/actual_value.csv'\n",
    "file_path_compare = '.\\Share_Bike_Data\\Output\\XGBoost_网格搜索.csv'\n",
    "\n",
    "# 读取两个文件\n",
    "df_baseline = pd.read_csv(file_path_baseline)\n",
    "df_compare = pd.read_csv(file_path_compare)\n",
    "            \n",
    "# 确保数据按id对齐，这里假设id列是按相同顺序排列的\n",
    "# 如果不是，您可能需要先对它们进行排序或使用merge操作来对齐数据\n",
    "rmse = sqrt(mean_squared_error(df_baseline['y'], df_compare['y']))\n",
    "\n",
    "print(f'RMSE: {rmse}')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-11T03:04:57.072169900Z",
     "start_time": "2024-04-11T03:04:57.023777800Z"
    }
   },
   "id": "2bcfa862fbb4d358"
  },
  {
   "cell_type": "markdown",
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "ba0305ca53551532"
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 半网格搜索+特征处理后的数据"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "6c3effda50aba66c"
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 24.41343705638936\n"
     ]
    }
   ],
   "source": [
    "# 文件1是基准文件，文件2是用来比较的文件\n",
    "file_path_baseline = './Share_Bike_Data/actual_value.csv'\n",
    "file_path_compare = '.\\Share_Bike_Data\\Output\\XGBoost_半网格搜索.csv'\n",
    "\n",
    "# 读取两个文件\n",
    "df_baseline = pd.read_csv(file_path_baseline)\n",
    "df_compare = pd.read_csv(file_path_compare)\n",
    "            \n",
    "# 确保数据按id对齐，这里假设id列是按相同顺序排列的\n",
    "# 如果不是，您可能需要先对它们进行排序或使用merge操作来对齐数据\n",
    "rmse = sqrt(mean_squared_error(df_baseline['y'], df_compare['y']))\n",
    "\n",
    "print(f'RMSE: {rmse}')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-11T03:04:57.107471600Z",
     "start_time": "2024-04-11T03:04:57.034606800Z"
    }
   },
   "id": "5e77817e3e2c651"
  },
  {
   "cell_type": "markdown",
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "c1af3327564df9d3"
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 随机搜索+特征处理后的数据"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "259b7a66e3764857"
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 24.336838203570377\n"
     ]
    }
   ],
   "source": [
    "# 文件1是基准文件，文件2是用来比较的文件\n",
    "file_path_baseline = './Share_Bike_Data/actual_value.csv'\n",
    "file_path_compare = '.\\Share_Bike_Data\\Output\\XGBoost_随机搜索.csv'\n",
    "\n",
    "# 读取两个文件\n",
    "df_baseline = pd.read_csv(file_path_baseline)\n",
    "df_compare = pd.read_csv(file_path_compare)\n",
    "            \n",
    "# 确保数据按id对齐，这里假设id列是按相同顺序排列的\n",
    "# 如果不是，您可能需要先对它们进行排序或使用merge操作来对齐数据\n",
    "rmse = sqrt(mean_squared_error(df_baseline['y'], df_compare['y']))\n",
    "\n",
    "print(f'RMSE: {rmse}')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-11T03:04:57.108858200Z",
     "start_time": "2024-04-11T03:04:57.050944600Z"
    }
   },
   "id": "fe3ca9642cbcc56a"
  },
  {
   "cell_type": "markdown",
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "a59e7803b6860f81"
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Andy的参数+特征处理后的数据"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "e08ca7f93942b8b2"
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 24.934203285433338\n"
     ]
    }
   ],
   "source": [
    "# 文件1是基准文件，文件2是用来比较的文件\n",
    "file_path_baseline = './Share_Bike_Data/actual_value.csv'\n",
    "file_path_compare = '.\\Share_Bike_Data\\Output\\XGBoost_Andy.csv'\n",
    "\n",
    "# 读取两个文件\n",
    "df_baseline = pd.read_csv(file_path_baseline)\n",
    "df_compare = pd.read_csv(file_path_compare)\n",
    "\n",
    "# 确保数据按id对齐，这里假设id列是按相同顺序排列的\n",
    "# 如果不是，您可能需要先对它们进行排序或使用merge操作来对齐数据\n",
    "rmse = sqrt(mean_squared_error(df_baseline['y'], df_compare['y']))\n",
    "\n",
    "print(f'RMSE: {rmse}')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-11T03:04:57.109797700Z",
     "start_time": "2024-04-11T03:04:57.065377300Z"
    }
   },
   "id": "13678450b46e4079"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
